<template>
	<view class="pages-box">
		<view class="shop-list pad30 mb30">
			<news-list :list="newsList"></news-list>
		</view>
		<u-loadmore :status="status" />
		<view class="uni-p-b-98"></view>
		<page-nav></page-nav>
	</view>
</template>

<script>
	import {getNewsType,getNewsList} from "@/api/news.js"
	import newsList from "@/components/news_list.vue"
	import pagenav from "@/components/page-nav/page-nav.vue"
	import {mapGetters} from "vuex";
	export default {
		computed: mapGetters(['isLogin','uid']),
		components:{
			newsList,
			pagenav
		},
		data() {
			return {
				tabData:{
					list: [],
					current: 0
				},
				newsList:[],
				typeId:0,
				limt:20,
				page:1,
				total:0,
				status: 'loadmore',
			};
		},
		created() {
			this.getNewsList()
		},
		onShareAppMessage: function() {
			return {
				title: this.$config.shareTitle,
				imageUrl: this.$config.adminUrl+'/upload/goulogo.png',
				desc: this.$config.shareTitle,
				path: `/pages/news/index?uid=${this.uid}`
			};
		},
		onShareTimeline: function() {
			return {
				title: this.shareTitle,
				imageUrl: this.$config.adminUrl+'/upload/goulogo.png',
				desc: this.shareTitle,
				path: `/pages/news/index?uid=${this.uid}`
			};
		},
		methods: {
			// 获取新闻列表
			getNewsList() {
				let param={
					list_rows:this.limt,
					page:this.page
				}
				getNewsList(param).then(res=>{
					if(res.code == 900){
						this.newsList=this.newsList.concat(res.data)
						this.page++;
						this.total += res.count
						if(this.limt >= res.count) this.status = 'nomore';
						else this.status = 'loading';
						
					}
				})
			}
		}
	}
</script>

<style lang="less">

</style>
